package com.ruoyi.mp.controller;

import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.db.domain.system.PcReturnConfig;
import com.ruoyi.mp.service.IPcReturnConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 银藻定返活动Controller
 * 
 * @author ruoyi
 * @date 2022-08-05
 */
@Api(value = "银藻定返活动",tags ="银藻定返活动")
@RestController
@RequestMapping("/mp/return/config")
public class PcReturnConfigController extends BaseController
{
    private static Logger log = LoggerFactory.getLogger(PcReturnConfigController.class);
    @Autowired
    private IPcReturnConfigService pcReturnConfigService;

    /**
     * 查询银藻定返活动列表
     */
    @ApiOperation(value = "查询银藻定返活动列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name="pcReturnConfig",value="银藻定返活动",paramType="form")
    })
    @GetMapping("/list")
    public TableDataInfo list(PcReturnConfig pcReturnConfig)
    {
        try {
            startPage();
            List<PcReturnConfig> list = pcReturnConfigService.selectPcReturnConfigList(pcReturnConfig);
            return getDataTable(list);
        }catch (Exception e){
            log.error("银藻定返活动发生异常",e);
        }
        return null;
    }


    /**
     * 获取银藻定返活动详细信息
     */
    @ApiOperation(value = "获取银藻定返活动详细信息")
    @ApiImplicitParam(name="id",value="银藻定返活动")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        try {
            return AjaxResult.success(pcReturnConfigService.selectPcReturnConfigById(id));
        }catch (Exception e){
            log.error("银藻定返活动发生异常",e);
        }
        return AjaxResult.error("银藻定返活动异常");
    }

}
